import lRequest from '@/service'
import type { IAccount } from '@/types'
import { localCache } from '@/utils/cache'

// 登录
export function accountLogin(account: IAccount) {
  return lRequest.post({
    url: '/login',
    data: account
  })
}

// 权限
export function getUserInfoById(id: number) {
  return lRequest.get({
    url: `/users/${id}`,
    headers: {
      Authorization: localCache.getCache('token')
    }
  })
}

// 菜单
export function getUserMenuByRoleId(id: number) {
  return lRequest.get({
    url: `/role/${id}/menu`
  })
}
